


//
//  PrintViewController.m
//  nncloud
//
//  Created by macfeel on 2019/5/23.
//  Copyright © 2019 macfai. All rights reserved.
//

#import "PrintViewController.h"
#import <WewinPrintExtApi/WewinPrintExtApi.h>
#import "TemplateUtils.h"

@interface PrintViewController ()

@property (weak, nonatomic) IBOutlet UIButton *preViewBtn;
@property (weak, nonatomic) IBOutlet UIButton *backBtn;


@end

@implementation PrintViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self.navigationItem setItemWithTitle:@"打印预览" textColor:kNavigationTitleColor fontSize:18 itemType:center];
    
    self.preViewBtn.layer.cornerRadius = 5.f;
    self.preViewBtn.layer.masksToBounds = YES;
    
    self.preViewBtn.backgroundColor = ThemeBlue;
    
    self.backBtn.layer.cornerRadius = 5.f;
    self.backBtn.layer.masksToBounds = YES;
    self.backBtn.backgroundColor = ThemeBlue;
//    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    btn.frame = CGRectMake(, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)
    // Do any additional setup after loading the view from its nib.
}


- (IBAction)preViewBtnAction:(UIButton *)sender {
    
    
     WwPrintUtils *printUtils = [WwPrintUtils getInstance];
    //可设置ble或者wifi模式
    printUtils.connectModel = ConnectModelWiFi;
    
    if ([[NUserModel shareInstance].printType isEqualToString:@"r"]) {
        [[WwPrintUtils getInstance] previewPrint:[TemplateUtils initRelayLabels] IPrintLabelCallback:^(WwPrintResult result) {
            NSLog(@"预览打印结果：%d", (int)result);
        }];
    }else if ([[NUserModel shareInstance].printType isEqualToString:@"s"]){
        [[WwPrintUtils getInstance] previewPrint:[TemplateUtils initSwitchLabels] IPrintLabelCallback:^(WwPrintResult result) {
            NSLog(@"预览打印结果：%d", (int)result);
        }];
        
    }else if([[NUserModel shareInstance].printType isEqualToString:@"c"]){
        [[WwPrintUtils getInstance] previewPrint:[TemplateUtils initLabels] IPrintLabelCallback:^(WwPrintResult result) {
            NSLog(@"预览打印结果：%d", (int)result);
        }];
    }else{
        [AFToast showText:@"开发中……"];
        
    }
   
    
   
}


- (IBAction)backAction:(UIButton *)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
}



//-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//
//    [super touchesBegan:touches withEvent:event];
//
//   
//}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
